<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<html>
<head>
    <meta charset="UTF-8">
    <title>用户${user.nickname }的信息</title>
    <script type="text/javascript">

    </script>
</head>
<body>
<div id="content">
    <h3 class="admin_link_bar">
        <jsp:include page="/jsp/common.jsp"></jsp:include>
    </h3>
    <input type="hidden" name="userId" value="${user.id }"/>
    <table width="800" align="center" cellpadding="0" cellspacing="0" class="thin-border">
        <tr>
            <td>用户标识:${user.id}</td>
        </tr>
        <tr>
            <td>用户名:${user.username }</td>
        </tr>
        <tr>
            <td>用户昵称:${user.nickname }</td>
        </tr>
        <tr>
            <td>用户状态:
                <c:if test="${user.status eq ture }">
                    <span class="emp">停用</span>
                </c:if>
                <c:if test="${user.status eq false }">
                    <span>启用</span>
                </c:if>
            </td>
        </tr>

        <tr>
            <td>用户登录时间:
                <%--<fmt:formatDate value="${user.loginData}" type="both"/>--%>
                <%--<fmt:parseDate value="${user.loginData}" var="date" pattern="yyyy/MM/dd:HH:mm:ss"/>--%>
                ${user.loginData}
            </td>
        </tr>
        <tr>
            <td>
                <a href="<%=request.getContextPath() %>/user/user/add/${user.id }">用户订单查询</a>
            </td>
        </tr>
        <tr>
            <td>
                用户联系地址:
                <c:if test="${user.id eq loginUser.id }">
                    <a href="<%=request.getContextPath() %>/user/address/add">添加联系地址</a>
                </c:if>

            </td>
        </tr>
        <c:if test="${empty user.addresses}">
            <tr>
                <td>没有添加地址</td>
            </tr>
        </c:if>
        <c:if test="${not empty user.addresses }">
            <c:forEach items="${user.addresses }" var="address">
                <tr>
                    <td>
                            ${address.name }[${address.postcode }](${address.phone })
                        <a href="<%=request.getContextPath() %>/user/address/update/${address.id }">修改</a>
                        &nbsp;<a href="<%=request.getContextPath() %>/user/address/delete/${address.id}">删除</a>
                    </td>
                </tr>
            </c:forEach>
        </c:if>

    </table>
</div>
</body>
</html>